{% extends "base.html" %}

{% block js %}

<script src="/static/js/ajax.js"></script>

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){

$('a.operation').click(function(){
    var obj = $(this);
    doPost(obj, obj.attr('href'), {action : obj.attr('data')});
    return false;
});

$('.modify').click(function() {
    var obj = $(this);
    var form = $('form')
    doPost(obj, form.attr('action'), form.serializeArray());
    return false;
});

});
</script>
{% endblock %}

{% block content %}

<p>案件类型：{{'自处理' if 0 == case.type else '公估公司'}}</p>
<!-- <p>出险地点：{{case.address}}</p>
<p>出险时间：{{case.insurance_time}}</p>
<p>出险原因：{{case.reason}}</p>
<p>估损金额：{{case.value}}</p> -->

<div>
    <form action="/company/{{active_company_id}}/case/{{case.id}}">
        <input name="action" type="hidden" value="modify">
        <p>出险地点：<input name='address' type='text' value="{{case.address}}"></p>
        <p>出险时间：<input name='insurance_time' type='text' value="{{case.insurance_time}}"></p>
        <p>出险原因：<input name='reason' type='text' value="{{case.reason}}"></p>
        <p>估损金额：<input name='value' type='text' value="{{case.value}}"></p>
    </form>
</div>

<a class="operation" href="/company/{{active_company_id}}/case/{{case.id}}" data="receive">接收确认</a>
<a class="operation" href="/company/{{active_company_id}}/case/{{case.id}}" data="push">提交</a>
<a class="operation" href="/company/{{active_company_id}}/case/{{case.id}}" data="undo">退回</a>
<a class="operation" href="/company/{{active_company_id}}/case/{{case.id}}" data="return">撤销</a>
<a class="modify">修改</a>
<table>
    <th>
        <td>操作时间</td><td>操作角色</td><td>操作类型</td><td>操作内容</td>
    </th>
{% for action in actions %}
    <tr>
        <td>{{action.operate_time}}</td><td>{{action.user_type}}</td><td>{{action.action_type}}</td><td>{{action.content}}</td>
    </tr>
{% endfor %}
</table>

{% endblock %}
